﻿using System.Linq;
using Moq;
using NUnit.Framework;

namespace PhotoFramePublishingPlugin.Tests
{
    [TestFixture]
    public class ConfigurationSettingsPresenterMaximumSizeOptionsTests
    {
        const string InitialDestinationRoot = @"D:\Temp";

        [Test]
        public void MaximumSizeOptions_ContainsExpectedOptions()
        {
            // TODO: The next two lines are common; factor them out.
            Mock<IConfigurationSettingsView> view = new Mock<IConfigurationSettingsView>(MockBehavior.Strict);
            ConfigurationSettingsModel model = new ConfigurationSettingsModel(800, 600, InitialDestinationRoot, false, false);

            ConfigurationSettingsPresenter presenter = new ConfigurationSettingsPresenter(view.Object, model);

            // There should be 6 of them, they should be distinct, and there should definitely be a custom size option in there.
            Assert.AreEqual(6, presenter.MaximumSizeOptions.Length);
            Assert.AreEqual(6, presenter.MaximumSizeOptions.Distinct().Count());
            Assert.AreEqual(1, presenter.MaximumSizeOptions.Count(x => x.Width == 0 && x.Height == 0));
        }
    }
}
